home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / rexx / cropmarks.pvrx < prev    next >
Text File  |  1995-02-28  |  4KB  |  184 lines

  1. /*
  2.  * This macro prompts the user to drag a box on the project which is
  3.  * the boundary to which crop marks will be drawn.  Crop marks,
  4.  * registration marks, and plate names will be drawn, all in the layer
  5.  * named "Crop Marks"
  6.  *
  7.  * This macro hopes that colors named Black, Cyan, Yellow, Magenta and
  8.  * 100% CMYK are present in the project, and that their values correspond
  9.  * to their names.  This, of course, is the default for ProVector 3.0
  10.  * newly created projects.
  11.  *
  12.  * Author:
  13.  *    Ross Cunniff, Stylus, Inc.
  14.  *    February 24, 1995
  15.  */
  16.  
  17. Address "ProVector"
  18.  
  19. arg arglist
  20. Cmd = word(arglist,1)
  21.  
  22. Options Results
  23. 'Lock Wait'
  24.  
  25. if Cmd = 'MENU' then do
  26.     /* Called from the menu */
  27.     'Prompt "Drag crop boundaries"'
  28.     'GetUserData 2 2 2 "CropMarks OK" ""'
  29. end
  30. else if Cmd = 'OK' then do
  31.     'EndPrompt'
  32.     'GetInputPoints Pts'
  33.     PX1 = Pts.0.X;    PY1 = Pts.0.Y
  34.     PX2 = Pts.1.X;    PY2 = Pts.1.Y
  35.  
  36.     'GetPageSize PSize'
  37.  
  38.     Size = 0.5
  39.  
  40.     if PSize.X1 > PSize.X2 then do
  41.         DX = -Size
  42.         if PX1 < PX2 then do
  43.             TX = PX1; PX1 = PX2; PX2 = TX
  44.         end
  45.     end
  46.     else do
  47.         DX = Size
  48.         if PX1 > PX2 then do
  49.             TX = PX1; PX1 = PX2; PX2 = TX
  50.         end
  51.     end
  52.  
  53.     if PSize.Y1 > PSize.Y2 then do
  54.         DY = -Size
  55.         if PY1 < PY2 then do
  56.             TY = PY1; PY1 = PY2; PY2 = TY
  57.         end
  58.     end
  59.     else do
  60.         DY = Size
  61.         if PY1 > PY2 then do
  62.             TY = PY1; PY1 = PY2; PY2 = TY
  63.         end
  64.     end
  65.  
  66.     EdgeWeight = 0.25 / 72.0
  67.  
  68.     EdgeColor = 0
  69.     BlackColor = 0
  70.     CyanColor = 5
  71.     MagentaColor = 7
  72.     YellowColor = 3
  73.  
  74.     /* Find the appropriate colors */
  75.     'NumColors'; NumC = Result
  76.     do i = 0 to NumC-1
  77.         'GetColorName i'; Name = Result
  78.         if Name = "Black"    then BlackColor = i
  79.         if Name = "Cyan"    then CyanColor = i
  80.         if Name = "Magenta"    then MagentaColor = i
  81.         if Name = "Yellow"    then YellowColor = i
  82.         if Name = "100% CMYK"    then EdgeColor = i
  83.     end
  84.  
  85.     'CurrentLayer'; OldLayer = Result
  86.     'DeleteLayer "Crop Marks"'
  87.     if RC ~= 0 then do
  88.         call Open( zzz, "CON:" )
  89.         call Writeln( zzz, "DeleteLayer failed!" )
  90.         call Writeln( zzz, RC )
  91.     end
  92.  
  93.     'CreateLayer "Crop Marks"'
  94.     'CurrentLayer "Crop Marks"'
  95.  
  96.     call DrawCropMark( PX1, PY1,  DX,  DY )
  97.     call DrawCropMark( PX1, PY2,  DX, -DY )
  98.     call DrawCropMark( PX2, PY1, -DX,  DY )
  99.     call DrawCropMark( PX2, PY2, -DX, -DY )
  100.  
  101.     call DrawRegMark( PX1 - DX / 2.0, (PY1 + PY2) / 2.0, Size*0.4 )
  102.     call DrawRegMark( PX2 + DX / 2.0, (PY1 + PY2) / 2.0, Size*0.4 )
  103.     call DrawRegMark( (PX1 + PX2) / 2.0, PY1 - DY / 2.0, Size*0.4 )
  104.     call DrawRegMark( (PX1 + PX2) / 2.0, PY2 + DY / 2.0, Size*0.4 )
  105.  
  106.     call DrawColorPlate( PX1       , PY1, DX, DY, "C", CyanColor )
  107.     call DrawColorPlate( PX1+    DX, PY1, DX, DY, "M", MagentaColor )
  108.     call DrawColorPlate( PX1+2.0*DX, PY1, DX, DY, "Y", YellowColor )
  109.     call DrawColorPlate( PX1+3.0*DX, PY1, DX, DY, "K", BlackColor )
  110.  
  111.     'CurrentLayer OldLayer'
  112.     'Repair'
  113. end
  114.  
  115. 'UnLock'
  116. exit
  117.  
  118. DrawCropMark: procedure    expose EdgeWeight EdgeColor
  119.     arg PX, PY, DX, DY
  120.  
  121.     Pts.0.X = PX
  122.     Pts.0.Y = PY - DY
  123.     Pts.1.X = PX
  124.     Pts.1.Y = PY - DY / 8.0
  125.     'Polyline 2 Pts'; Obj = Result
  126.     'ChangeEdgeType Obj 1'
  127.     'ChangeEdgeWidth Obj EdgeWeight'
  128.     'ChangeEdgeVal Obj EdgeColor'
  129.  
  130.     Pts.0.X = PX - DX
  131.     Pts.0.Y = PY
  132.     Pts.1.X = PX - DX / 8.0
  133.     Pts.1.Y = PY
  134.     'Polyline 2 Pts'; Obj = Result
  135.     'ChangeEdgeType Obj 1'
  136.     'ChangeEdgeWidth Obj EdgeWeight'
  137.     'ChangeEdgeVal Obj EdgeColor'
  138.  
  139.     return
  140.  
  141.  
  142. DrawRegMark: procedure    expose EdgeWeight EdgeColor
  143.     arg PX, PY, Rad
  144.  
  145.     Pts.0.X = PX - Rad
  146.     Pts.0.Y = PY
  147.     Pts.1.X = PX + Rad
  148.     Pts.1.Y = PY
  149.     'Polyline 2 Pts'; Obj = Result
  150.     'ChangeEdgeType Obj 1'
  151.     'ChangeEdgeWidth Obj EdgeWeight'
  152.     'ChangeEdgeVal Obj EdgeColor'
  153.  
  154.     Pts.0.X = PX
  155.     Pts.0.Y = PY - Rad
  156.     Pts.1.X = PX
  157.     Pts.1.Y = PY + Rad
  158.     'Polyline 2 Pts'; Obj = Result
  159.     'ChangeEdgeType Obj 1'
  160.     'ChangeEdgeWidth Obj EdgeWeight'
  161.     'ChangeEdgeVal Obj EdgeColor'
  162.  
  163.     Rad = Rad * 0.75
  164.     'Arc PX PY Rad Rad 0 360'; Obj = Result
  165.     'ChangeFillType Obj 0'
  166.     'ChangeEdgeType Obj 1'
  167.     'ChangeEdgeWidth Obj EdgeWeight'
  168.     'ChangeEdgeVal Obj EdgeColor'
  169.     return
  170.  
  171. DrawColorPlate: procedure
  172.     arg PX, PY, DX, DY, Char, Color
  173.     DX = DX / 4.0
  174.     DY = DY / 2.0
  175.     PX = PX + DX
  176.     PY = PY - DY
  177.     'Text Char PX PY DX DY 0'; Obj = Result
  178.     'ChangeFillType Obj 1'
  179.     'ChangeEdgeType Obj 1'
  180.     'ChangeFillVal Obj Color'
  181.     'ChangeEdgeVal Obj Color'
  182.     'ChangeEdgeWidth Obj 0'
  183.     return
  184.